import { createRouter ,createWebHashHistory} from 'vue-router'


const routes = [
  {
    path:'/',
    component:()=>import('@/App.vue'),
    redirect:{
      path:'/login'
    },
    children:[
      {
        path:'login',
        component:()=>import('@/components/login/login.vue')
      },
      {
        path:'home',
        component:()=>import('@/components/layout/layout.vue')
      }
    ]
  },
 
]

const router = createRouter({
  history:createWebHashHistory(),
  routes
})

router.beforeEach((to, from, next) => {
  // if (to.path === '/login') next()
  // const tokenStr = storage.get('token',false)
  // // 增加判断条件
  // if (!tokenStr && to.path !== '/login'){
  //   console.log(tokenStr)
  //   return next('/login')
  // }
  
  next()
})
export default router